Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the Elmish music player example to use IStorageProvider instea… #407

Merged
merged 3 commits into from
Jul 24, 2024

Conversation

Numpsy
Copy link
Collaborator

@Numpsy Numpsy commented Mar 24, 2024

…d of the obsoleted OpenFileDialog/OpenFolderDialog

As it stands, there are a bunch of build warnings about using the deprecated file / folder picker APIs, and this is an attempt to sort those by changing it to use the newer IStorageProvider interfaces.

Notes:

  1. Only changes the picker access, the files/folder are still stored as string file paths
  2. IStorageFolder has functions for listing items in the folder, but they're async, so I left populateFromDirectory mapping back into paths to avoid further changes for now.

@Numpsy
Copy link
Collaborator Author

Numpsy commented Mar 27, 2024

Only presently tested on Windows - will try to try it on a mac next week.

Hmm, the only mac I have to try it on is an old Intel iMac, but on that the existing example code crashes with an error about drag regions being invalidated off the main thread when I click the open menu items :-(

@JaggerJo
Copy link
Member

@Numpsy I can test on a modern mac if you want.

@Numpsy
Copy link
Collaborator Author

Numpsy commented Mar 28, 2024

@Numpsy I can test on a modern mac if you want.

Making it call the open-picker functions through Dispatcher.UIThread.InvokeAsync has got it working on the old iMac and on Windows and I can try it on Ubuntu later, so if you'd be able to try it on a newer mac that'd be useful (my knowledge of how this interops with runWithAvaloniaSyncDispatch in Elmish programs is rather thin)

I can try it on Ubuntu later

Ok, it worked on my Ubuntu 22.04 / Gnome / Wayland laptop but it needed an update to a newer version of LibVLCSharp to fix some startup errors about libX11, so I'll see about doing that too.

@Numpsy Numpsy changed the title [WIP] Change the Elmish music player example to use IStorageProvider instea… Change the Elmish music player example to use IStorageProvider instea… Apr 1, 2024
@Numpsy Numpsy marked this pull request as ready for review April 1, 2024 10:57
@Numpsy
Copy link
Collaborator Author

Numpsy commented May 9, 2024

Anyway, this works for me on

Windows
Ubuntu 22.04 (Gnome / Wayland)
macOS 10.15

When in only worked on Windows before.

@JaggerJo If you're able to test on a current mac before merging that would be nice (I've seen other bugs where the file dialog behaviour got changed in macOS updates, so may as well try even though it's only an example I think)

@Numpsy
Copy link
Collaborator Author

Numpsy commented Jul 22, 2024

After the Avalonia 11.1 update is merged, I'll update this one on top of that and retest

@Numpsy
Copy link
Collaborator Author

Numpsy commented Jul 23, 2024

Updated on top of the .NET 8.0 / Avalonia 11.1 changes.

@JaggerJo JaggerJo merged commit bb21b83 into fsprojects:master Jul 24, 2024
1 check passed
@Numpsy Numpsy deleted the music_storage branch July 24, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants